import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';

class MyLoadding extends StatefulWidget {
  @override
  _MyLoaddingState createState() => _MyLoaddingState();
}

class _MyLoaddingState extends State<MyLoadding>
    with SingleTickerProviderStateMixin {
  AnimationController _controller;

  @override
  void initState() {
    super.initState();
    _controller = AnimationController(
        vsync: this, duration: const Duration(milliseconds: 1200));
  }

  Widget loaddingWidget() {
    return Column(
      mainAxisAlignment: MainAxisAlignment.center,
      crossAxisAlignment: CrossAxisAlignment.center,
      children: [
        SpinKitThreeBounce(
          size: 60,
          controller: _controller,
//    color:Colors.red,
          itemBuilder: (BuildContext context, int index) {
            return Padding(
              padding: EdgeInsets.all(2),
              child: DecoratedBox(
                decoration: BoxDecoration(
                  borderRadius: BorderRadius.circular(5),
                  color: index.isEven ? Colors.blue : Colors.blue,
                ),
              ),
            );
          },
        ),
        SizedBox(height: 20.w),
        Text(
          '努力加载中',
          style: TextStyle(fontSize: 26.sp,color: Colors.black87),
        )
      ],
    );
  }

  @override
  Widget build(BuildContext context) {
    ScreenUtil.init(context, width: 750, height: 1334);
    return Center(
      child: Padding(
        padding: EdgeInsets.all(10.0),
        child: loaddingWidget(),
      ),
    );
  }
}
